package com.cnhis.cloudhealth.clinical.hosnurse.hosadvice.dao;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.cnhis.cloudhealth.commons.dao.BaseDao;
import com.cnhis.cloudhealth.commons.utils.Page;
@Repository
public class HosAdviceDao extends BaseDao{
	public Integer adviceint(Map map)throws Exception{
		String getCountSqlDef = "HosAdvice.adviceList1Count";
		/*获取查询结果的记录总数*/
		int total = ((Integer)getSqlSession().selectOne(getCountSqlDef,map)).intValue();
		return total;
	}
	public Page adviceList(Map map, int currPage,int pageSize)throws Exception{
		String getCountSqlDef = "HosAdvice.adviceListCount";
		
		/*获取查询结果的记录总数*/
		int total = ((Integer)getSqlSession().selectOne(getCountSqlDef,map)).intValue();
		int  pageIndex = currPage-1;
		pageIndex = pageIndex<0?0:pageIndex;
		currPage = currPage<1?1:currPage;
		/*开始记录的位置*/
		int  startNum = 0;
		startNum = pageIndex*(pageSize<1?1:pageSize);
		map.put("currPage", startNum);
		map.put("pageSize", pageSize);
		List  list =  queryForList("HosAdvice.adviceList", map);
		return new Page(list, pageSize,total,currPage);
		
	}
	public List patientList(Map map)throws Exception{
		return queryForList("HosAdvice.patientList", map);
	}
	public Page stopAdviceList(Map map, int currPage,int pageSize)throws Exception{
		return queryForPage("HosAdvice.stopAdviceList", map, currPage, pageSize);
		
	}
	public Page sendAdviceList(Map map, int currPage,int pageSize)throws Exception{
		return queryForPage("HosAdvice.sendAdviceList", map, currPage, pageSize);
	}
	public Page sendOtherAdviceList(Map map, int currPage,int pageSize)throws Exception{
		return queryForPage("HosAdvice.sendOtherAdviceList", map, currPage, pageSize);
	}
}
